import { request } from '@/http/axios';
import { IBase, IRecords } from '../app';

export interface IBookReader extends IBase {
  id?: number;
  readerId: number | string;
  readerName: string;
  bookId: number | string;
  bookName: string;
  cover: string;
  author: string;
  status: number | string;
}

function insert(data) {
  return request({
    url: '/borrow/insert',
    data,
    method: 'POST'
  });
}

function updateStatus(data) {
  return request({
    url: '/borrow/updateStatus',
    data,
    method: 'POST'
  });
}

function records(data) {
  return request<IRecords<IBookReader>>({
    url: '/borrow/records',
    data,
    method: 'post'
  });
}

export const bookReaderModel = {
  insert,
  updateStatus,
  records
};
